// pages/joke/joke.js
import server from '../../public/server.js'
import api from '../../public/api.js'

Page({
  data() {
   jokeList:[]
  },
  onLoad(){
    this.getJoke();
  },
  //获得笑话
  getJoke() {
    let url = api.apiObj.joke.url;
    let dataObj = {
      key: api.apiObj.joke.key,
      sort: "desc"
    }
    server.GET(url,dataObj,this.showJoke)

  },
  showJoke(res){
    this.setData({
      jokeList:res.result.data
    })
  }
})